-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: replace [].join() with ''.repeat() #12305
Conversation
@abouthiroppy It seems these two cases in node/test/parallel/test-stringbytes-external.js Lines 48 to 49 in 98e54b0
|
@vsemozhetbyt Good catch! |
Thanks @vsemozhetbyt @abouthiroppy , done. |
const size = 1 + (1 << 20); | ||
write_str = Array(size).join(write_str); | ||
ucs2_control = Array(size).join(ucs2_control); | ||
const size = 1 << 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to change size
in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you do the Array.join()
it ends up as one less than size
, so when you move to repeat you have to decrease size by one to get the same string length.
> Array(3).join('a')
'aa'
> 'a'.repeat(3)
'aaa'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Thanks.
CI failure unrelated. Figured we can land this. Landed in 4a782e1 |
Replace [].join calls with the more modern .repeat PR-URL: #12305 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
Replace [].join calls with the more modern .repeat PR-URL: #12305 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
Replace [].join calls with the more modern .repeat PR-URL: #12305 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
Replace [].join calls with the more modern .repeat PR-URL: #12305 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
Should this be backported to v6.x? |
Replace [].join calls with the more modern .repeat PR-URL: #12305 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
This only affects |
Replace [].join calls with the more modern .repeat PR-URL: #12305 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
Replace [].join calls with the more modern .repeat PR-URL: #12305 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
Like PR #12170 .
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test